﻿Public Class FormSettings
    Dim WindowerDisplay As New WindowerFFXI.Display
    Private Sub btnOK_Click(sender As System.Object, e As System.EventArgs) Handles btnOK.Click
        My.Settings.random = chkRandom.Checked
        My.Settings.repeat = chkRepeat.Checked

        My.Settings.LocX = Convert.ToInt32(txtX.Text)
        My.Settings.LocY = Convert.ToInt32(txtY.Text)

        If cboDisplay.Text = "Single Line" Then
            My.Settings.display = "single"
        ElseIf cboDisplay.Text = "Multiline" Then
            My.Settings.display = "multi"
        End If

        If chkTopMost.Checked = True Then
            FormMain.TopMost = True
            My.Settings.topmost = True
        Else
            FormMain.TopMost = False
            My.Settings.topmost = False
        End If

        My.Settings.Save()
        FormMain.ReloadSettings()
        FormMain.UpdateDisplay()
    End Sub

    Private Sub btnCancel_Click(sender As System.Object, e As System.EventArgs) Handles btnCancel.Click
        Me.Close()
    End Sub

    Private Sub FormSettings_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        chkRandom.Checked = My.Settings.random
        chkRepeat.Checked = My.Settings.repeat
        txtX.Text = My.Settings.LocX
        txtY.Text = My.Settings.LocY
        If My.Settings.Display = "single" Then
            cboDisplay.SelectedIndex = 0
        ElseIf My.Settings.Display = "multi" Then
            cboDisplay.SelectedIndex = 1
        End If
        chkTopMost.Checked = My.Settings.topmost
    End Sub

End Class